<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<!--只在模块名下面有效 -->
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui"%>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>推荐管理</title>
<jsp:include page="../../import.jsp" flush="true" />
<style>
.visit_rec_detail_win {
	text-align: left !important;
	padding: 10px 25px 25px 25px;
}
</style>
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<div id="pageInTab" class="pageInTab">
				<div tabid="tabA" title="推荐管理" lselected="true">
					<div class="searchArea">
						<form id="searchBar">
							<div class="fieldset1 clearFix">
								<div class="fieldBox col_33" id="cstMgrOrgCdId">
									<div class="label">推荐人手机号</div>
									<div class="field">
					                	<input name="oldUsrMp" id="oldUsrMp" type="text" class="ui-textbox" value="">
					                </div>
								</div>
								<div class="fieldBox col_33" id="cstMgrOrgCdId">
									<div class="label">活动类型</div>
									<div class="field">
										
										<select name="activityTypCd" id="activityTypCd">
											<option value=" ">请选择</option>
											<c:forEach items="${activityTypCdMap }" var="map">
												<option value="${map.key }">${map.value }</option>
											</c:forEach>
										</select>
									</div>
								</div>
								<div class="fieldBox col_33" id="cstMgrOrgCdId">
									<div class="label">所属经销商</div>
									<div class="field">
										<input name="oldUsrSplNm" id="oldUsrSplNm" type="text"
											class="ui-textbox" value="">
									</div>
								</div>
								<div class="fieldBox">
									<div class="label">登录时间</div>
									<div class="field">
										<input ligerui="width: 120" name="loginTmStar"
											id="loginTmStar" type="text" class="ui-datepicker" value=""
											validate="{required:true}"> - <input
											ligerui="width: 120" name="loginTmEnd" id="loginTmEnd"
											type="text" class="ui-datepicker" value=""
											validate="{required:true}">
									</div>
								</div>
								<div class="fieldBox">
									<div class="label">准入时间</div>
									<div class="field">
										<input ligerui="width: 120" name="accessTmStar"
											id="accessTmStar" type="text" class="ui-datepicker" value=""
											validate="{required:true}"> - <input
											ligerui="width: 120" name="accessTmEnd" id="accessTmEnd"
											type="text" class="ui-datepicker" value=""
											validate="{required:true}">
									</div>
								</div>
							
								<div class="clearFix"></div>
								<div class="btnsBox">
									<span id="searchBtn" class="sq-button sq-button-round">查询</span>
									<span onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
								</div>
							</div>
						</form>
					</div>
					
					<div id="ligergridDB" class="sq-grid"></div>
					
				</div>
			</div>
		</div>
	</div>

	<script type="text/javascript">
		var gridDB = null;
		var pageInApp = {}; // to 下一级子窗口 接口
		var queryFlag = '${queryFlag}'; //只查询列表
		var pageInTab = null;
		var loadedTabs = [];
		$(function() {
			initTab();
			initGridDB(); //初始化待办列表
			$("#searchBar").ligerForm();
			$("#searchBtn").click(function(event) {
				reloadGrid();
			});
		});
	
		//重新加载GRID
		function reloadGrid() {
			var form = new liger.get("searchBar");
			var data = form.getData();
			for (name in data) {
				console.log('name:' + name + ',data:' + data[name]);
				gridDB.setParm(name, data[name]);
			}
			;
			gridDB.reload();
		}
	
		//初始化列表
		function initGridDB() {
			$("#ligergridDB").ligerGrid({
				url : '<%=path%>/spl/splActivityRec/initList.do',
				method : 'get',
				columns : [
					{
						display : '活动类型',
						name : 'activityTypCd',
						width : 60,
						enabledSort : false,
						render : function(rowdata, index, value){
							if (value == 'WAL011'){
								return '新人注册';
							}
							if (value == 'WAL012'){
								return '企业准入';
							}
						}
					},
					{
						display : '推荐人姓名',
						name : 'oldUsrNm',
						minWidth : 30,
						enabledSort : false
					},
					{
						display : '推荐人手机号',
						name : 'oldUsrMp',
						minWidth : 80,
						enabledSort : false
					},
					{
						display : '所属经销商',
						name : 'oldUsrSplNm',
						minWidth : 150,
						enabledSort : false
					},
					{
						display : '被推荐人',
						name : 'newUsrNm',
						minWidth : 30,
						enabledSort : false
					},
					{
						display : '被推荐人手机号',
						name : 'newUsrMp',
						minWidth : 80,
						enabledSort : false
					},
					{
						display : '被推荐人是否准入',
						name : 'isAccess',
						minWidth : 80,
						enabledSort : false,
						render : function(rowdata, index, value){
							if (value == 1)return '是';
							if (value == 0)return '否';
						}
					},
					{
						display : '被推荐人第一次登录时间',
						name : 'firstLoginTm',
						minWidth : 100,
						enabledSort : false,
						render : function(rowdata, index, value){
							return renderDate2(null, null, value);
						}
					},
					{
						display : '被推荐人准入时间',
						name : 'accessTm',
						minWidth : 100,
						enabledSort : false,
						render : function(rowdata, index, value){
							return renderDate2(null, null, value);
						}
					}
				],
				pageSize : 10,
				pageSizeOptions : [ 10, 20, 30, 40, 50, 100 ], //按照自己的喜好选择不同的页面显示条数
				root : 'rows',
				record : 'total',
				hideLoadButton : true,
				width : '100%',
				height : '100%',
				heightDiff : -30,
				//checkbox : true,
				rownumbers : true,
				onAfterShowData : function() {
					$(".gridTip").grid_ligerTip();
					SetIframe_height();
				},
				onLoaded : function (grid) {
					//console.log(grid);
					grid.toggleLoading(null);
					//console.log(grid.data.total);
				}
			});
			gridDB = liger.get("ligergridDB");
			gridDB.setHeight(100);
			gridDB.options.isSingleCheck = true;
		}
	
		//格式化时间
		function renderDate2(rowdata, index, value) {
			var dateStr = "";
			if (null != value) {
				var date = new Date(value);
				dateStr = DateUtils.formatDate(date, "yyyy-MM-dd hh:mm");
			}
			return dateStr;
		}
	
		function clearBtn() {
			clearLigerForm("searchBar");
			//liger.get("buOrgCd").clear();//清空树
		}
	
		function iframeResize() {
			if (parent.mainApp) {
				parent.mainApp.parentTab.onResize();
			}
			;
		}
	
		//初始化Tab页
		function initTab() {
			pageInTab = $("#pageInTab").ligerTab({
				height : 'auto',
				contextmenu : false,
				minIframeHeight : GET_minIframeHeight(),
				onAfterSelectTabItem : function(tabid) {
					currTab = tabid; //赋值是哪个Tab页面
					if (loadedTabs.indexOf(tabid) < 0) {
						loadedTabs.push(tabid);
						switch (tabid) {
						case "tabB":
							pageInTab.setTabItemSrc(tabid, "<%=path%>/bizflow/rskUsrAchLog/toMyAchievementsPage.do");
							break;
						}
					}
					;
					SetIframe_height();
				}
			});
	
			$.extend(true, pageInApp, {
				pageInTab : pageInTab
			});
		}
	</script>

</body>
</html>
